package train48days;

import java.util.Arrays;
public class 微信红包 {
    public int getValue(int[] gifts, int n) {
        Arrays.sort(gifts);
        int a = gifts[gifts.length/2];
        int count=0;
        for (int i = 0; i < gifts.length; i++) {
            if (gifts[i]==a){
                count++;
            }
        }
        return count> gifts.length/2 ? a:0;
    }
}
